# Maintainer: Anatol Pomozov <anatol.pomozov@gmail.com>
# Contributor: Øyvind 'Mr.Elendig' Heggstad <mrelendig@har-ikkje.net>
# Contributor: Fabrizio Antonangeli <fabrizio.antonangeli@gmail.com>

pkgname=dfu-util
pkgver=0.11
pkgrel=2
pkgdesc='Tool intended to download and upload firmware using DFU protocol to devices connected over USB'
url='http://dfu-util.sourceforge.net/'
license=(GPL2)
arch=(loong64 x86_64)
depends=(libusb)
optdepends=(
  'python: dfuse-pack tool support'
  'python-intelhex: Intel HEX file format support'
)
source=(http://dfu-util.sourceforge.net/releases/$pkgname-$pkgver.tar.gz)
sha256sums=('b4b53ba21a82ef7e3d4c47df2952adf5fa494f499b6b0b57c58c5d04ae8ff19e')

build() {
  cd $pkgname-$pkgver
  ./autogen.sh
  ./configure --prefix=/usr
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -Dm755 dfuse-pack.py "$pkgdir"/usr/bin/dfuse-pack
  install -Dm644 doc/60-dfuse.rules "$pkgdir"/usr/lib/udev/rules.d/60-dfuse.rules
}
